<?php
/**
 *
 * @author Ice <iceinto@mallog.com.cn>
 */
class CommonAction extends BaseAction
{
    function _initialize()
    {
        // 用户权限检查
        if (!getLoginUserInfo()) {
            $this->assign('jumpUrl', U('/login'));
            $this->errorLang('_VALID_ACCESS_');
        }
        parent::_initialize();
    }

    /**
     * 强制用户关注商场和品牌
     * @author Ice <iceinto@mallog.com.cn>
     */
    function checkUserAttr()
    {
        $uid = getLoginUserInfo();
        $map['uid'] = $uid;
        $mCount = M('MarketAttention')->where($map)->count();
        if ($mCount < 1) {
            $this->assign('jumpUrl', U('guidestart/mall'));
            $this->errorLang('_NOT_ATTR_MALL_');
        }
        $bCount = M('BrandAttention')->where($map)->count();
        if ($bCount < 1) {
            $this->assign('jumpUrl', U('guidestart/brand'));
            $this->errorLang('_NOT_ATTR_BRAND_');
        }
        $this->assign('mall_att_count', $mCount);
        $this->assign('brand_att_count', $bCount);
    }
}

?>